package lab02.test33;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by 阿阿阿阿豪丶 on 2017/11/22.
 */
public class Test {
    public static void main(String[] args) {
        List<String> input = new ArrayList<>();


        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入单词：");
        String m = scanner.nextLine();

        //用split将一个字符串分割为子字符串，然后将结果作为字符串数组返回。
        String[] a = m.split(",");
        for (int i = 0;i < a.length;i++){
            for (int j = i + 1;j < a.length;j++){
                if (a[i].compareToIgnoreCase(a[j]) > 0){
                    m = a[i];
                    a[i] = a[j];
                    a[j] = m;
                }
            }
        }

        for (String inputs : a){
            input.add(inputs);
            System.out.println(inputs);
        }

    }
}
